/**  
 * All rights Reserved, Designed By www.woniuxy.com
 * @Title:  Account.java   
 * @Package com.woniu.domain   
 * @Description:    Description  
 * @author: 蜗牛学院  
 * @date:   2019年8月22日 下午6:52:04
 * @user:   Administrator  
 * @version V1.0 
 * @Copyright: 2019 www.woniuxy.com Inc. All rights reserved. 
 * 注意：本内容仅限于成都蜗牛创想科技有限公司，禁止外泄以及用于其他的商业目
 */ 
package com.woniu.ssh.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniu.ssh.dao.AnimalDao;
import com.woniu.ssh.domain.Animal;
import com.woniu.ssh.domain.Category;
import com.woniu.ssh.domain.Distribution;
import com.woniu.ssh.utils.PageBean;
import com.woniu.ssh.utils.Queryv;

/**
 * @author Administrator
 *
 */
@Service
@Transactional
public class AnimalServiceImpl implements AnimalService{
	@Autowired
	AnimalDao animalDao;
	@Override
	public List<Animal> findAnimalList() {
		
		return animalDao.findAnimalList();
	}
	@Override
	public PageBean findAnimalList(Queryv query) {
		PageBean pb = new PageBean();
		if(query == null) {
			pb.setPageNow(0);
		}else {
			pb.setPageNow(query.getPageNow());
		}
		List<Animal> lists = animalDao.findAnimalLists(query,pb);
		//pb.setLists(lists);
		int count = animalDao.AnimalCount(query);
		//pb.setRowCount(count);
		return new PageBean(pb.getPageNow(),count,lists);
	}
	@Override
	public List<Category> findAllCategory() {
		return animalDao.findAllCategory();
	}
	@Override
	public List<Distribution> findAllDisttibution() {
		return animalDao.findAllDistibution();
	}
	@Override
	public void insertAnimal(Animal animal) {
		animalDao.insertAnimal(animal);
	}
	@Override
	public Animal findAnimalById(int aid) {
		return animalDao.findAnimalById(aid);
	}

}
